package net.wangds.program.auth.repo.rdbms;

import net.wangds.auth.module.UserStatusEnum;
import net.wangds.data.RemovedEnum;
import net.wangds.jpa.repository.RemovableRepo;
import net.wangds.program.auth.module.AuthAccount;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface AuthAccountJpaRepo extends RemovableRepo<AuthAccount> {

    /**
     * 查找账户.
     * @param loginName 登录名.
     * @param status 状态.
     * @param removed 是否删除.
     * @return 账户实体.
     */
    Optional<AuthAccount> findByLoginnameAndStatusAndRemoved(String loginName, UserStatusEnum status, RemovedEnum removed);

    /**
     * 查找账户.
     * @param loginName 登录名.
     * @return 账户实体.
     */
    Optional<AuthAccount> findByLoginname(String loginName);


    boolean existsByLoginname(String loginname);

}
